# update的一个分支 
@app.route("/a01m2/sm2_sign/<id>",methods=['GET','POST'])     
def a01m2_sm2_sign(id):
    id = id
    logging.warning("edit row id:%s",id)
    #打开节点下的数据库
    app_dir = os.path.realpath(os.path.dirname(__file__))
    database_path = os.path.join(app_dir, 'instance/thousandsdb.sqlite')   
    logging.warning("[a01m2_update_nav] database_path:%s",database_path) 
    conn=sqlite3.connect( database_path )
    conn.text_factory = str

    conn.row_factory = dict_factory

    cur = conn.cursor()
    t = 'app_fd_blockchain_a01_m2'
    cur.execute("select * from app_fd_blockchain_a01_m2 where id = '"+id+"'")
    results  = cur.fetchall() 
    logging.warning("[results]：%s",results)
    
    conn.close()
    return render_template("a01m2/update.html",rows=results)
	
	
	
{% extends 'base.html' %}

{% block header %}
  <h1>{% block title %}本页面实现用户用自己的SM2 私钥对内容进行加签，其他用户可以用该用户的公钥进行验证是否是该用户的签名，从而实现了对内容所有者的确权{% endblock %}</h1>
{% endblock %}

{% block content %}
  {% for row in rows %}
  <form method="post" action="/a01m2/update">
    <label for="title">标题</label>
	<br />
    <input name="field40" id="title" value="{{ row['c_field40'] }}" size="100" required>
    <br />
	<label for="body">内容</label>
    <br />
	<label for="order_no">签名私钥</label>
	<p></p>
	<input name="field5" id="order_no" value="{{ row.c_field21 }}" size="80" required>
	<p></p>
	<label for="order_no">验证签名公钥</label>
	<p></p>	
	<input name="field5" id="order_no" value="{{ row.c_field22 }}" size="80" required>
		
	<textarea name="field39" cols="100" rows="20" id="body">{{ row.c_field39 }}</textarea>
	<p></p> <label for="body">订单号</label>
	<br />
	<input name="field5" id="order_no" value="{{ row.c_field5 }}" size="80" readonly="readonly">
	<p></p>
	<label for="order_no">创建者ID</label>
	<p></p>
	<input name="createdBy" id="createdBy" value="{{ row.createdBy }}" size="80" readonly="readonly">
	<p></p>	
	<label for="id">记录ID</label>
	<p></p>
	<input name="id" id="id" value="{{ row.id }}" size="80" readonly="readonly">
	<p></p>		
    <input type="submit" value="更新|Save">
  </form>
  
  <hr>
  <!--
  <form action="{{ url_for('blog.delete', id= row.id ) }}" method="post">
    <input class="danger" type="submit" value="Delete" onclick="return confirm('Are you sure?');">
  </form>-->
  {% endfor %}
{% endblock %}
